;;
X_MIN	= 0
X_MAX	= 25-1
Y_MIN	= 0
Y_MAX	= 80-1

;;Color Code
BLACK		= 00000000b
BLUE		= 00000001b
GREEN		= 00000010b
CYAN		= 00000011b
RED		= 00000100b
MAGENTA		= 00000101b
BROWN		= 00000110b
LIGHTGRAY	= 00000111b
DARKGRAY	= 00001000b
LIGHTBLUE	= 00001001b
LIGHTGREEN	= 00001010b
LIGHTCYAN	= 00001011b
LIGHTRED	= 00001100b
LIGHTMAGENTA	= 00001101b
YELLOW		= 00001110b
WHITE		= 00001111b

;;;
VideoStruct struc
	rows	db ?
	columns	db ?
	IsCGA	db ?
	IsColor db ?
	VideoSegment	dw ?
	VideoOffset	dw ?
VideoStruct ends

;;;
WindowStruct struc
	X1	db 0
	Y1	db 0
	X2	db 0
	Y2	db 0
	BorderAttribute	db 0
	TextAttribute	db 0
	SaveBuffer	dw 0
WindowStruct ends

;;;
ComputeVideoAddress	macro
	push	ax
	mov	al, [bx].VideoStruct.columns
	mul	dh
	xor	dh, dh
	add	ax, dx
	shl	ax, 1
	add	ax, [bx].VideoStruct.VideoOffset
	mov	di, ax
	pop	ax
	mov	es, [bx].VideoStruct.VideoSegment
	endm

;;;
SYNCHWAIT	macro
	local wait1, wait2
	mov	dx, 03DAh
wait1:	in	al, dx
	test	al, 1
	jnz	wait1
wait2:	in	al, dx
	test	al, 1
	jz	wait2
	endm

	
